package ketang.unit5;



import ketang.inherit.Student;

import java.util.HashMap;
import java.util.Map;

public class MapTest {
    public static void main(String[] args) {
        //实例化一个MAP m
        Map m=new HashMap();
        //构造三个学生对象
        Student s1=new Student("丁一","1111","xxxxx");
        Student s2=new Student("王二","2222","xxxxx");
        Student s3=new Student("张三","3333","xxxxx");
        Student s4=new Student("丁一","4444","xxxxx");
        //
        m.put("丁一",s1);
        m.put("王二",s2);
        m.put("张三",s3);
        m.put("丁一",s4);//后添加的会把前面的丁一覆盖掉，后下手为强。

        System.out.println(m.size());
        Student o=(Student)m.get("丁一");
        System.out.println(o.toString());  //得到丁一

    }

}
